using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using hao_Model;
using hao_Common.Dapper.Repository;

namespace hao_Reppsitory
{
    /// <summary>
    /// 商品留言仓储接口
    /// </summary>
    public interface IProductCommentRepository : IGenericRepository<ProductComment>
    {
        /// <summary>
        /// 根据商品ID获取留言列表（分页）
        /// </summary>
        /// <param name="productId">商品ID</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">每页数量</param>
        /// <returns>留言列表和总数</returns>
        Task<(List<ProductComment> comments, int total)> GetCommentsByProductIdAsync(Guid productId, int page, int pageSize);

        /// <summary>
        /// 根据父留言ID获取回复列表
        /// </summary>
        /// <param name="parentId">父留言ID</param>
        /// <returns>回复列表</returns>
        Task<List<ProductComment>> GetRepliesByParentIdAsync(Guid parentId);

        /// <summary>
        /// 获取留言的点赞数量
        /// </summary>
        /// <param name="commentId">留言ID</param>
        /// <returns>点赞数量</returns>
        Task<int> GetLikeCountAsync(Guid commentId);

        /// <summary>
        /// 检查用户是否已点赞留言
        /// </summary>
        /// <param name="commentId">留言ID</param>
        /// <param name="userId">用户ID</param>
        /// <returns>是否已点赞</returns>
        Task<bool> IsLikedByUserAsync(Guid commentId, Guid userId);

        /// <summary>
        /// 更新留言点赞数量
        /// </summary>
        /// <param name="commentId">留言ID</param>
        /// <param name="increment">增量（+1或-1）</param>
        /// <returns>更新结果</returns>
        Task<bool> UpdateLikeCountAsync(Guid commentId, int increment);
    }
}